package com.sense.kukoo.biz_library.net

import com.sense.kukoo.common.repo.bean.*
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path

interface LibraryHttpApi {

    /**收听记录分页查询*/
    @POST("/api/book/library/listen/app/query-page/{pageIndex}/{pageSize}")
    suspend fun listenQueryPage(
        @Path("pageIndex") pageIndex: String,
        @Path("pageSize") pageSize: String
    ): ResultBean<QueryPageBean<LibraryListenBean>>

    /**删除收听记录*/
    @POST("/api/book/library/listen/delete")
    suspend fun listenDelete(@Body requestBody: RequestBody): ResultBean<Boolean>

    /**订阅记录分页查询*/
    @POST("/api/book/library/subscription/app/query-page/{pageIndex}/{pageSize}")
    suspend fun subscriptionQueryPage(
        @Path("pageIndex") pageIndex: String,
        @Path("pageSize") pageSize: String
    ): ResultBean<QueryPageBean<LibrarySubscriptionBean>>

    /**订阅单集更新分页查询*/
    @POST("/api/book/library/subscription/app/query-item-page/{pageIndex}/{pageSize}")
    suspend fun subscriptionQueryItemPage(
        @Path("pageIndex") pageIndex: String,
        @Path("pageSize") pageSize: String
    ): ResultBean<QueryPageBean<BookItemBean>>

    //默认携带40条章节数据,若想继续加载则需调整分页起始位置(eg: pageSize = 20, pageIndex = 3 (40 / 20 + 1))
    /**详情*/
    @GET("/api/book/details/{id}")
    suspend fun bookDetails(@Path("id") id: String): ResultBean<BookDetailsBean>

    /**切换-订阅/未订阅 订阅记录*/
    @POST("/api/user/subscription/sub/{bookId}")
    suspend fun subscription(@Path("bookId") bookId: String): ResultBean<Boolean>

    /**取消小红点*/
    @POST("/api/user/subscription/lightOff/{id}")
    suspend fun lightOff(@Path("id") id: String): ResultBean<Boolean>

}